#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5;
int n,ri,lst = 0,ans,maxr;
map<int,int>r;
int read(){
    int x = 0,f = 1;
     char c;
     c = getchar();
     while(!isdigit(c) && c != '-'){
        c = getchar();
     }
     if(c == '-'){
        f = -1;
        c = getchar();
     }
     while(isdigit(c)){
        x = x * 10 + c - '0';
        c = getchar();
     }
     return f * x;
}
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin >> n;
    for(int i = 1;i <= n;i++){
        ri = read();
        maxr = max(maxr,ri);
        r[ri]++;
    }
    for(int i = 1;i <= maxr;i++){
        if(r[lst] <= r[i]){
            r[lst] = 0;
            lst = i;
            continue;
        }
        r[lst] -= r[i];
    }
    for(int i = 1;i <= maxr;i++){
        ans += r[i];
    }
    cout << ans << endl;
    fclose(stdin);
    fclose(stdout);
    return 0;
}
